package edu.cuit.avatar.service.bean;

import edu.cuit.avatar.dao.PaymentDao;
import edu.cuit.avatar.po.Payment;
import edu.cuit.avatar.service.PaymentService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author <a href="mailto:1020zhaodan@163.com">Adan</a>
 * @version 1.0
 * @date 2025/8/14 11:00
 */
@Service
public class PaymentServiceBean implements PaymentService {
    @Resource private PaymentDao dao;

    /**
     * MANDATORY: 方法必须在事务内运行
     *            否则抛出异常
     */
    @Transactional(propagation = Propagation.MANDATORY)
    @Override
    public void payment(Payment payment) {
        dao.insert(payment);
    }
}
